﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Media.Animation;
using System.Windows;

namespace Passwords.Utils
{
    public static class AnimationUtil
    {
        public static void Prepare(this UserControl userControl)
        {
            userControl.IsVisibleChanged += OnVisibleChanged;
        }

        private static void OnVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            UserControl uc = sender as UserControl;
            if (uc.Resources.Contains("VisibleStoryboard"))
            {
                Storyboard sb = uc.Resources["VisibleStoryboard"] as Storyboard;
                if (sb != null) sb.Begin();

            }
        }       

    }
}
